package utils

import (
	"github.com/timandy/routine"
)

var userIdThreadLocal = routine.NewThreadLocal()

func GetThreadUserId() int {
	get := userIdThreadLocal.Get()
	if get == nil {
		return -1
	}
	return get.(int)
}

func SetThreadUserId(userId int) {
	userIdThreadLocal.Remove()
	userIdThreadLocal.Set(userId)
}
